import Router from "koa-router";
import UserController from "../controller/user.controller.js";
import {
  verifyUserIsExist,
  verifyUserIsNull,
  verifyUserLogin,
  bcryptPassWord,
  verifyUserToken,
} from "../midware/user.midware.js";

const router = new Router({ prefix: "/users" });

router.post(
  "/register",
  verifyUserIsNull,
  verifyUserIsExist,
  bcryptPassWord,
  UserController.register
);

router.post("/login", verifyUserIsNull, verifyUserLogin, UserController.login);

router.post("/test", verifyUserToken, (ctx) => {
  ctx.body = 1111;
});

router.get("/test1", (ctx) => {
  ctx.body = 1111;
});

export default router;
